package com.ds.pojo;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;

/**
 * @program: Spring-Study
 * @description:
 * @author: Dawson.Zhang
 * @create: 2020-04-04
 **/
@Component
//等价于 <beans id="user" class="com.ds.pojo.User"> 前提是开启了扫包注解

//@Scope(value = "prototype")
//spring 默认是单列模式的，加上该注解则会变成多列
public class User {
    @Value("张保国")
//  <property  name="name" value="张保国"/>
    private String name;
    @Autowired
    private Cat cat;


    public User() {
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Cat getCat() {
        return cat;
    }

    public void setCat(Cat cat) {
        this.cat = cat;
    }

    @Override
    public String toString() {
        return "User{" +
            "name='" + name + '\'' +
            ", cat=" + cat +
            '}';
    }
}
